
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fHotelDetailedRevenue]') AND type in (N'U'))
DROP TABLE [DW].[fHotelDetailedRevenue]

GO 

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fHotelRoomAvailability]') AND type in (N'U'))
DROP TABLE [DW].[fHotelRoomAvailability]

GO 

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fHotelReservationEntry]') AND type in (N'U'))
DROP TABLE [DW].[fHotelReservationEntry]

GO 
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fHotelRoomBlockedEntry]') AND type in (N'U'))
DROP TABLE [DW].[fHotelRoomBlockedEntry]

GO 
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DW].[fHotelGuestList]') AND type in (N'U'))
DROP TABLE [DW].[fHotelGuestList]

GO 
/****** Object:  Table [DW].[fHotelRoomBlockedEntry]    Script Date: 20-Jan-23 10:18:48 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [DW].[fHotelRoomBlockedEntry](
	[SK_Company] [int] NULL,
	[SK_Customer] [int] NULL,
	[SK_Location] [int] NULL,
	[SK_HotelRooms] [int] NULL,
	[Entry No_] [int] NULL,
	[Blocked from] [date] NULL,
	[Blocked to] [date] NULL,
	[Active] [int] NULL,
	[Release DateTime] [datetime] NULL,
	[Quantity] [int] NULL,
	[Channel Type] [int] NULL,
	[Source] [varchar](3) NOT NULL,
	[ExplodedDate] [date] NULL
) ON [PRIMARY]
GO

/****** Object:  Table [DW].[fHotelRoomAvailability]    Script Date: 20-Jan-23 10:18:35 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [DW].[fHotelRoomAvailability](
	[SK_Company] [int] NULL,
	[Date] [date] NULL,
	[SK_HotelRooms] [int] NULL,
	[SK_Location] [int] NULL,
	[Total Rooms] [int] NULL,
	[Available Rooms] [int] NULL,
	[Blocked Rooms] [int] NULL
) ON [PRIMARY]
GO

/****** Object:  Table [DW].[fHotelReservationEntry]    Script Date: 20-Jan-23 10:18:24 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [DW].[fHotelReservationEntry](
	[SK_Company] [int] NULL,
	[Date] [datetime] NULL,
	[Reservation No_] [nvarchar](20) NULL,
	[Entry No_] [int] NULL,
	[Arrival Date] [date] NULL,
	[Departure Date] [date] NULL,
	[Booking Date] [date] NULL,
	[Cancelation DateTime] [date] NULL,
	[DaysFromBookingToArrivalOrCancel] [int] NULL,
	[SK_Customer] [int] NULL,
	[SK_Location] [int] NULL,
	[SK_HotelRooms] [int] NULL,
	[SK_PayHotelRooms] [int] NULL,
	[No_ of Rooms] [int] NULL,
	[Currency] [nvarchar](10) NULL,
	[Country] [nvarchar](20) NULL,
	[Market Segment] [nvarchar](20) NULL,
	[Reservation Channel] [nvarchar](100) NULL,
	[Reservation Type Description] [nvarchar](20) NULL,
	[Status] [int] NULL,
	[Status Description] [varchar](11) NULL
) ON [PRIMARY]
GO


/****** Object:  Table [DW].[fHotelGuestList]    Script Date: 20-Jan-23 10:18:09 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [DW].[fHotelGuestList](
	[Reservation No_] [nvarchar](20) NULL,
	[SK_Company] [int] NOT NULL,
	[Arrival Date] [datetime] NULL,
	[Departure Date] [datetime] NULL,
	[Guest Name] [nvarchar](100) NULL,
	[Guest No_] [nvarchar](20) NULL,
	[SK_Customer] [int] NULL,
	[Status] [nvarchar](20) NULL,
	[SK_Location] [int] NOT NULL,
	[AccountNo] [nvarchar](100) NULL,
	[Country] [nvarchar](100) NULL,
	[Guest Type] [nvarchar](20) NULL,
	[GuestGroupType] [int] NULL,
	[Description] [nvarchar](50) NULL,
	[Market Segment] [nvarchar](20) NULL,
	[Reservation Channel] [nvarchar](100) NULL,
	[SK_HotelRooms] [int] NOT NULL,
	[GuestId] [nvarchar](32) NOT NULL
) ON [PRIMARY]
GO

/****** Object:  Table [DW].[fHotelDetailedRevenue]    Script Date: 20-Jan-23 10:17:55 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [DW].[fHotelDetailedRevenue](
	[SK_Company] [int] NULL,
	[SK_Item] [int] NULL,
	[SK_Location] [int] NULL,
	[SK_HotelRoom] [int] NULL,
	[SK_Customer] [int] NULL,
	[Entry No_] [int] NULL,
	[Reservation No_] [nvarchar](20) NULL,
	[Transaction Type] [int] NULL,
	[Activity Internal Status] [int] NULL,
	[Revenue Type] [int] NULL,
	[Paid] [tinyint] NULL,
	[Included in Rate] [tinyint] NULL,
	[Quantity] [decimal](38, 20) NULL,
	[Amount] [decimal](38, 20) NULL,
	[Date] [datetime] NULL,
	[Reservation Channel] [nvarchar](100) NULL,
	[Market Segment] [nvarchar](20) NULL,
	[Status] [nvarchar](20) NULL
) ON [PRIMARY]
GO

